package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SysGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysGroupMapper;
import com.ruoyi.system.service.ISysGroupService;
import com.ruoyi.common.core.text.Convert;

/**
 * 角色组Service业务层处理
 *
 * @author ruoyi
 * @date 2020-06-19
 */
@Service
public class SysGroupServiceImpl implements ISysGroupService
{
    @Autowired
    private SysGroupMapper sysGroupMapper;

    /**
     * 查询角色组
     *
     * @param groupId 角色组ID
     * @return 角色组
     */
    @Override
    public SysGroup selectSysGroupById(Long groupId)
    {
        return sysGroupMapper.selectSysGroupById(groupId);
    }

    /**
     * 查询角色组列表
     *
     * @param sysGroup 角色组
     * @return 角色组
     */
    @Override
    public List<SysGroup> selectSysGroupList(SysGroup sysGroup)
    {
        return sysGroupMapper.selectSysGroupList(sysGroup);
    }

    /**
     * 新增角色组
     *
     * @param sysGroup 角色组
     * @return 结果
     */
    @Override
    public int insertSysGroup(SysGroup sysGroup)
    {
        sysGroup.setCreateTime(DateUtils.getNowDate());
        return sysGroupMapper.insertSysGroup(sysGroup);
    }

    /**
     * 修改角色组
     *
     * @param sysGroup 角色组
     * @return 结果
     */
    @Override
    public int updateSysGroup(SysGroup sysGroup)
    {
        sysGroup.setUpdateTime(DateUtils.getNowDate());
        return sysGroupMapper.updateSysGroup(sysGroup);
    }

    /**
     * 删除角色组对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysGroupByIds(String ids)
    {
        return sysGroupMapper.deleteSysGroupByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除角色组信息
     *
     * @param groupId 角色组ID
     * @return 结果
     */
    public int deleteSysGroupById(Long groupId)
    {
        return sysGroupMapper.deleteSysGroupById(groupId);
    }
}
